/**
 * 
 */
package org.swing.utility.common.holder;

/**
 * @author lqnhu
 *
 */
public class ValueHolder<V> {
	private V value;

	/**
	 * @deprecated should be immutable, will be removed in Camel 3.0
	 */
	@Deprecated
	public ValueHolder() {
	}

	public ValueHolder(V val) {
		value = val;
	}

	public V get() {
		return value;
	}

	/**
	 * @deprecated should be immutable, will be removed in Camel 3.0
	 */
	@Deprecated
	public void set(V val) {
		value = val;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o) {
			return true;
		}
		if (o == null || getClass() != o.getClass()) {
			return false;
		}
		ValueHolder<?> that = (ValueHolder<?>) o;
		if (value != null ? !value.equals(that.value) : that.value != null) {
			return false;
		}
		return true;
	}

	@Override
	public int hashCode() {
		return value != null ? value.hashCode() : 0;
	}
}
